/*
 ============================================================================
 Name		: AutoTesterAppView.cpp
 Author	  : 
 Copyright   : Your copyright notice
 Description : Application view implementation
 ============================================================================
 */

// INCLUDE FILES
#include <coemain.h>
#include "AutoTesterAppView.h"
#include "autotesterengine.h"
#include "mtalog.h"
#include "gdi.h"
#include <AutoTester.mbg>
_LIT(KmbmPath,"\\resource\\apps\\AutoTester.mbm");
// ============================ MEMBER FUNCTIONS ===============================

// -----------------------------------------------------------------------------
// CAutoTesterAppView::NewL()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CAutoTesterAppView* CAutoTesterAppView::NewL(const TRect& aRect)
{
	CAutoTesterAppView* self = CAutoTesterAppView::NewLC(aRect);
	CleanupStack::Pop(self);
	return self;
}

// -----------------------------------------------------------------------------
// CAutoTesterAppView::NewLC()
// Two-phased constructor.
// -----------------------------------------------------------------------------
//
CAutoTesterAppView* CAutoTesterAppView::NewLC(const TRect& aRect)
{
	CAutoTesterAppView* self = new ( ELeave ) CAutoTesterAppView;
	CleanupStack::PushL(self);
	self->ConstructL(aRect);
	return self;
}

// -----------------------------------------------------------------------------
// CAutoTesterAppView::ConstructL()
// Symbian 2nd phase constructor can leave.
// -----------------------------------------------------------------------------
//
void CAutoTesterAppView::ConstructL(const TRect& aRect)
{
	// Create a window for this application view
	CreateWindowL();
	iBitmap= new (ELeave) CFbsBitmap();
	iBitmap->Load(KmbmPath,EMbmAutotesterAutotester,0);

	// Set the windows size
	SetRect(aRect);

	// Activate the window, which makes it ready to be drawn
	ActivateL();
}

// -----------------------------------------------------------------------------
// CAutoTesterAppView::CAutoTesterAppView()
// C++ default constructor can NOT contain any code, that might leave.
// -----------------------------------------------------------------------------
//
CAutoTesterAppView::CAutoTesterAppView()
{
	// No implementation required
}

// -----------------------------------------------------------------------------
// CAutoTesterAppView::~CAutoTesterAppView()
// Destructor.
// -----------------------------------------------------------------------------
//
CAutoTesterAppView::~CAutoTesterAppView()
{
	// No implementation required
	delete iBitmap;
}

// -----------------------------------------------------------------------------
// CAutoTesterAppView::Draw()
// Draws the display.
// -----------------------------------------------------------------------------
//
void CAutoTesterAppView::Draw(const TRect& /*aRect*/) const
{
	// Get the standard graphics context
	CWindowGc& gc = SystemGc();
	gc.BitBlt(TPoint(0,0),iBitmap);
}

// -----------------------------------------------------------------------------
// CAutoTesterAppView::SizeChanged()
// Called by framework when the view size is changed.
// -----------------------------------------------------------------------------
//
void CAutoTesterAppView::SizeChanged()
{
	DrawNow();
}

TKeyResponse CAutoTesterAppView::OfferKeyEventL(const TKeyEvent& aKeyEvent,TEventCode aType)
{
	/*if(aKeyEvent.iCode != 0)
	{
		LOGTXT("-----------------------------");
		LOGARG("ICODE = %d",aKeyEvent.iCode);
		LOGARG("SCANCODE = %d",aKeyEvent.iScanCode);
		LOGARG("MODIFIERS = %d",aKeyEvent.iModifiers);
		LOGARG("REPEATS = %d",aKeyEvent.iRepeats);
		LOGTXT("-----------------------------");
	}*/
	return EKeyWasNotConsumed;
}

// End of File
